#include "textmessageevent.h"
#include "converse/converseabstractconversation.h"
#include "converse/conversetextmessage.h"
#include "converse/conversemanager.h"
#include "appchat/accountmanager.h"


TextMessageEvent::TextMessageEvent(qint64 id,
                                   qint64 sendingId,
                                   qint64 conversationId,
                                   qint64 createdTime,
                                   qint64 senderId,
                                   qint64 receiverId,
                                   const QString &text,
                                   QObject *parent)
    : MessageEvent(id,
                   sendingId,
                   conversationId,
                   createdTime,
                   senderId,
                   receiverId,
                   parent)
    , m_text(text)
{
}


MessageEvent::MessageEventType
TextMessageEvent::messageEventType() const
{
    return MessageEvent::TextMessageEvent;
}


Converse::AbstractMessage *
TextMessageEvent::createMessage(const Converse::AbstractConversation &conversation,
                                QObject *parent) const
{
    return new Converse::TextMessage(id(),
                                     sendingId(),
                                     conversation,
                                     createdTime(),
                                     createdTime(),
                                     senderId(),
                                     receiverId(),
                                     text(),
                                     parent);
}
